#include "unp.h"

void 
str_echo(int sockfd) {
    ssize_t     n;
    char        buf[MAXLINE];

again:
    while((n = read(sockfd, buf, MAXLINE)) > 0) {
        if (n != writen(sockfd, buf, n))
            err_sys("writen error\n");;
    }
    if (n < 0 && errno == EINTR)//表示被信号中断 
        goto again;
    else if (n < 0)
        perror("reading from sockfd");
}

